﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_DSJCJ.BLL
{
    /// <summary>
    /// 短句 逻辑类
    /// </summary>
    public class SysPhrase
    {
        /// <summary>
        /// 短句数据类
        /// </summary>
        private DAL.SysPhrase sysPhraseDAL = new DAL.SysPhrase();
        public SysPhrase()
        {
        }
        /// <summary>
        /// 获取最新短句 部分字段 FPhrase,FURL
        /// <creator>wangl</creator>
        /// <date>2013-09-04</date>
        /// </summary>
        /// <param name="entityNo"></param>
        /// <returns></returns>
        public Model.SysPhrase GetModelPart(string entityNo)
        {
            return sysPhraseDAL.GetModelPart(entityNo);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<ElingOA6_DSJCJ.Model.SysPhrase> GetModelList(string strWhere)
        {
            DataSet ds = sysPhraseDAL.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<ElingOA6_DSJCJ.Model.SysPhrase> DataTableToList(DataTable dt)
        {
            List<ElingOA6_DSJCJ.Model.SysPhrase> modelList = new List<ElingOA6_DSJCJ.Model.SysPhrase>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                ElingOA6_DSJCJ.Model.SysPhrase model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = sysPhraseDAL.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }
    }
}
